home *** CD-ROM | disk | FTP | other *** search
- !
- ! Copyright (c) 1994
- ! by CompuServe Incorporated, Columbus, Ohio
- !
- ! The information in this software is subject to change without
- ! notice and should not be construed as a commitment by CompuServe.
- !
- ! CSERVE:
- ! Connect to CIS.
- ! First argument is %TRUE if direct connect and %FALSE otherwise
- ! Success: returns %Success
- ! Failure: saves error msg in %FailureMsg and returns %Failure
- ! or %Fatal (depending on severity).
- !
- !+V
- ! "3.5.2"
- !-V
-
- DirectConnect = Arg1;
- show "Connecting to CompuServe Network";
- Tries = 7;
- on cancel goto Return_Cancel;
- FirstTry = %TRUE;
- FailStr = "";
- ETX = "^C";
- CompuServeHost = "CPS^M";
- ifndef %X121Address = "";
- ifndef %OKCmd = "";
- ifndef %StopAtHost = "";
- ifndef %AccountID = "";
- ifndef %BreakChar = "#";
-
- Start_Connect:
- if Tries = 0 goto CIS_Error;
- Tries = Tries - 1;
-
- Connect_Wait:
- wait
- "UIC:" goto Send_ETX,
- "Host Name:" goto Send_Host_Name,
- "User ID:" goto Send_ID,
- "Password:" goto Send_Password,
- "XPAD:" goto Send_XPAD,
- "ITI:" goto Send_XPAD,
- "? LOG" goto Process_Log_Msg,
- "??LOG" goto Process_Log_Msg,
- "% IPN" goto Process_IPX_Msg,
- "? IPX" goto Process_IPX_Msg,
- %mdm_Failure goto CIS_No_Carrier
- until 80;
-
- if not DirectConnect goto Send_CR;
- sendm %BreakChar;
- sendm %BreakChar;
- sendm %BreakChar;
-
- Send_CR:
- send %CR;
- goto Start_Connect;
-
- Send_ETX:
- send ETX;
- goto Connect_Wait;
-
- Send_Host_Name:
- if Arg2 goto No_Wait;
- wait until 10;
- No_Wait:
- if %StopAtHost = "" goto Send_No_Stop;
- if %StopAtHost = "1" goto Return_Success;
- send CompuServeHost;
- goto Return_Success;
-
- Send_No_Stop:
- send CompuServeHost;
- goto Connect_Wait;
-
- Send_ID:
- define %ErrorCode = 0;
- show "Logging onto CompuServe";
- send %UserID & %LogonParams & "/INT" & %CR;
- goto Connect_Wait;
-
- Send_Password:
- send %Password & %CR;
- goto Logon_Wait;
-
- Send_XPAD:
- if %X121Address = "" goto Missing_XPAD;
- send %X121Address & %CR;
- goto Connect_Wait;
-
- Missing_XPAD:
- define %FailureMsg = "Missing X.121 address";
- define %ErrorCode = 21;
- exit %Fatal;
-
- Logon_Wait:
- wait
- "Account ID:" goto Send_AccountID,
- "CompuServe" goto Return_Success,
- "^[[>" goto Return_Success,
- "^F" goto Return_Success,
- "? LOG" goto Process_Log_Msg,
- "??LOG" goto Process_Log_Msg,
- "% IPN" goto Process_IPX_Msg,
- "? IPX" goto Process_IPX_Msg,
- " NTW" goto Logon_Failure,
- "OK^M" goto Send_OK_Cmd,
- "^[I" goto Send_Response,
- %mdm_Failure goto CIS_No_Carrier
- until 200;
-
- define %ErrorCode = 22;
- goto CIS_Failure;
-
- Process_Log_Msg:
- wait
- "INE" goto Bad_ID,
- "ISX" goto Bad_ID_Syntax,
- "CAI" goto Cannot_Auto_Irun,
- "SIL" goto System_Unavailable,
- "SIU" goto System_Unavailable,
- "SNA" goto System_Unavailable,
- "STU" goto Check_User_ID,
- "UTL" goto Too_Many_Users
- until 50;
-
- goto Try_Again;
-
- Process_IPX_Msg:
- define %ErrorCode = 23;
- define %FailureMsg = "InfoPlex is unavailable, try again later";
- exit %Failure;
-
- Send_AccountID:
- send %AccountID & %CR;
- goto Logon_Wait;
-
- Too_Many_Users:
- define %ErrorCode = 29;
- define %FailureMsg = "Simultaneous users exceeded";
- exit %Failure;
-
- Cannot_Auto_Irun:
- define %FailureMsg = "Cannot Auto Irun HMI server";
- exit %Failure;
-
- Bad_ID:
- define %ErrorCode = 24;
- FailStr = "Incorrect User ID or password";
- goto Try_Again;
-
- Bad_ID_Syntax:
- define %ErrorCode = 25;
- FailStr = "Incorrect User ID syntax";
- goto Try_Again;
-
- System_Unavailable:
- define %ErrorCode = 23;
- define %FailureMsg = "The system is unavailable, try again later";
- exit %Fatal;
-
- Check_User_ID:
- define %ErrorCode = 26;
- define %FailureMsg = "The system is unavailable, check User ID";
- exit %Fatal;
-
- Try_Again:
- if not FirstTry goto CIS_Fatal;
- send ETX;
- FirstTry = %FALSE;
-
- wait
- "User ID" goto Send_ID,
- %mdm_Failure goto CIS_No_Carrier
- until 140;
-
- goto CIS_Fatal;
-
- Logon_Failure:
- define %ErrorCode = 27;
- define %FailureMsg = "Remote is busy or unavailable";
- exit %Fatal;
-
- Send_OK_Cmd:
- if %OKCmd = "" goto Logon_Wait;
- send %OKCmd & %CR;
- goto Logon_Wait;
-
- Send_Response:
- sendi %ESCIResponse;
- exit %Success;
-
- CIS_Error:
- define %ErrorCode = 20;
- CIS_Failure:
- if FailStr <> "" goto Return_Fail_Msg;
- define %FailureMsg = "Unable to connect to CompuServe host";
- exit %Failure;
-
- CIS_No_Carrier:
- define %ErrorCode = 28;
- if FailStr <> "" goto Return_Fail_Msg;
- define %FailureMsg = "Modem connection lost";
- exit %Failure;
-
- CIS_Fatal:
- if FailStr <> "" goto Return_Fatal_Msg;
- define %FailureMsg = "Unable to connect to CompuServe host";
- exit %Fatal;
-
- Return_Fail_Msg:
- define %FailureMsg = FailStr;
- exit %Failure;
-
- Return_Fatal_Msg:
- define %FailureMsg = FailStr;
- exit %Fatal;
-
- Return_Success:
- exit %Success;
-
- Return_Cancel:
- exit %Cancel;
-